/-app
/-docs ...
/-docs/types ...
/-docs/types/text ...
/-docs/types/text/base
/-docs/types/text/css
/-docs/types/text/html
/-docs/types/text/js
/-docs/types/text/json
/-docs/types/text/less
/-docs/types/text/sass
/-docs/types/text/scrollerView
/-docs/types/text/scss
CodeMirror-ext.css
CodeMirrorDocHandler.ts
api.ts
load.ts
api.ts
listSubmodules.ts
load.ts
DocHost.ts
/-files
/-imports
/-persistence
/-typescript
/-typings
errors.js
functions.ts
index.html
try.js
161
        line: lineCount - 1,
162
        ch: doc.getLine(lineCount - 1).length - 1
163
      }) + 1;
164
​
165
      if (this._validLead + this._validTrail === this._retrievedText.length
166
         && this._retrievedText.length === totalLength)
167
        return this._retrievedText;
168
​
169
      if (this._validLead + this._validTrail < totalLength / 4) { // if more than 0.75 of the document is modified
170
        this._retrievedText = doc.getValue();
171
        this._validLead = -1;
172
        return this._retrievedText;
173
      }
174
​
175
      var mid = doc.getRange(
176
        doc.posFromIndex(this._validLead),
177
        doc.posFromIndex(totalLength - this._validTrail));
178
      
179
      this._retrievedText =
180
        this._retrievedText.slice(0, this._validLead) +
181
        mid +
182
        this._retrievedText.slice(this._retrievedText.length - this._validTrail);
183
      this._validLead = -1;
184
      
185
      return this._retrievedText;
186
    }
187
​
188
    private _docChanges(docChanges: CodeMirror.EditorChange[]) {
189
​
190
      var doc = this.textDoc.doc;
191
​
192
      var lineCount = doc.lineCount();
193
      var totalLength = doc.indexFromPos({
194
        line: lineCount - 1,
195
        ch: doc.getLine(lineCount - 1).length - 1
196
      });
197
​
198
      for (var i = 0; i < docChanges.length; i++) {
199
        var ch = docChanges[i];
200
        var fromIndex = doc.indexFromPos(ch.from);
201
        var toIndex = doc.indexFromPos(ch.to);
202
        var trail = totalLength - toIndex;
203
        
204
        if (this._validLead < 0) {
205
          this._validLead = fromIndex;
206
          this._validTrail = trail;
207
        }
208
        else {
209
          this._validLead = Math.min(this._validLead, fromIndex);
210
          this._validTrail = Math.min(this._validTrail, trail);
211
        }
212
​
213
      }
214
​
215
      if (this.textDoc.onChanges)
216
        this.textDoc.onChanges(docChanges);
217
​
218
      if (this._scrollerModel)
219
        this._scrollerModel.docChanges(docChanges);
220
​
221
      this._saveTimer.interval = (this.moduleObj && this.moduleObj.saveDelay) || saveDelay;
222
      this._saveTimer.reset();
223
​
224
    }
225
​
226
    private _cursorActivity() {
227
      if (this.textDoc.onCursorMoved) {
228
        var cursorPos = this.textDoc.doc.getCursor();
229
        //this.textDoc.status.textContent = 'token '+this.textDoc.editor.getTokenAt(cursorPos).type;
213:0